<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box"></div>
    <script>

        // 1. 模板字符串
        let str = `
            <允许换行的一种字符串的方式>
            <保留原格式，每一个换行都会保留>
            <h1>大标题</h1>
        `;

        box.innerHTML = str;
        console.log(str);

        // 2. 动态的模板字符串
        var city = ['武汉', '长沙', '重庆', '天津'];
        let code = ``;
        for (var i = 0; i < city.length; i++) {
            code += `
                <a href="#">${city[i]}</a>
            `
        }
        console.log(code);

    </script>
</body>

</html>